package com.aiyige.utils.removal.model;

public class VideoCacheChildModel {

    public static final int STATUS_WAIT_DOWNLOAD = 0;//未下载
    public static final int STATUS_FINISHED = 1;//下载完成
    public static final int STATUS_DOWNING = 2;//正在下载
    public static final int STATUS_PAUSE = 3;//暂停

    private int localId;
    private String videoId;
    private String title;
    private String url;
    private String path;
    private String imageUrl;
    private long size;
    private long compeleteSize;
    /**
     *  0 : 未读  1 : 已读
     */
    private int isRead;
    /**
     * 0 : 未下载  1 ：下载完成   2 : 正在下载  3 : 暂停
     */
    private int status;
    private int page;
    private long duration;

//    public long lastDownloadTime;//最后一次下载的时间

    public VideoCacheChildModel() {
    }

    private VideoCacheChildModel(Builder builder) {
        setLocalId(builder.localId);
        setVideoId(builder.videoId);
        setTitle(builder.title);
        setUrl(builder.url);
        setPath(builder.path);
        setImageUrl(builder.imageUrl);
        setSize(builder.size);
        setCompeleteSize(builder.compeleteSize);
        setIsRead(builder.isRead);
        setStatus(builder.status);
        setPage(builder.page);
        setDuration(builder.duration);
//        lastDownloadTime = builder.lastDownloadTime;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public int getLocalId() {
        return localId;
    }
    public void setLocalId(int localId) {
        this.localId = localId;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public long getSize() {
        return size;
    }
    public void setSize(long size) {
        this.size = size;
    }
    public long getCompeleteSize() {
        return compeleteSize;
    }
    public void setCompeleteSize(long compeleteSize) {
        this.compeleteSize = compeleteSize;
    }
    public int getIsRead() {
        return isRead;
    }
    public void setIsRead(int isRead) {
        this.isRead = isRead;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getImageUrl() {
        return imageUrl;
    }
    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }
    public int getPage() {
        return page;
    }
    public void setPage(int page) {
        this.page = page;
    }
    public long getDuration() {
        return duration;
    }
    public void setDuration(long duration) {
        this.duration = duration;
    }
    public String getVideoId() {
        return videoId;
    }
    public void setVideoId(String videoId) {
        this.videoId = videoId;
    }

    public static final class Builder {
        private int localId;
        private String videoId;
        private String title;
        private String url;
        private String path;
        private String imageUrl;
        private long size;
        private long compeleteSize;
        private int isRead;
        private int status;
        private int page;
        private long duration;
//        private long lastDownloadTime;

        private Builder() {
        }

        public Builder localId(int val) {
            localId = val;
            return this;
        }

        public Builder videoId(String val) {
            videoId = val;
            return this;
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder url(String val) {
            url = val;
            return this;
        }

        public Builder path(String val) {
            path = val;
            return this;
        }

        public Builder imageUrl(String val) {
            imageUrl = val;
            return this;
        }

        public Builder size(long val) {
            size = val;
            return this;
        }

        public Builder compeleteSize(long val) {
            compeleteSize = val;
            return this;
        }

        public Builder isRead(int val) {
            isRead = val;
            return this;
        }

        public Builder status(int val) {
            status = val;
            return this;
        }

        public Builder page(int val) {
            page = val;
            return this;
        }

        public Builder duration(long val) {
            duration = val;
            return this;
        }

//        public Builder lastDownloadTime(long val) {
//            lastDownloadTime = val;
//            return this;
//        }

        public VideoCacheChildModel build() {
            return new VideoCacheChildModel(this);
        }
    }


    public boolean isDownloaded() {
        return status == 1;
    }
}
